/*
 *  This file is part of WWWPal.
 *
 *  Copyright (C) 2003  Dr. John Punin, Department of Computer Science
 *  Rensselaer Polytechnic Institute
 *
 *  WWWPal is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  WWWPal is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef LOGR_INDEPENDENT_LINKS_H
#define LOGR_INDEPENDENT_LINKS_H

#include <sys/stat.h>
#include <sys/fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <ctype.h>
#include <sys/time.h>
#include <assert.h>
#include <gr_graph_fun.h>

#include "LOGR_gen_pages.h"
#include "LOGR_webstat.h"

typedef struct _web_independent_link_node {
    TypePage tps;
    void *nodeptrs;
    TypePage tpt;
    void *nodeptrt;
    long naccesses;
    char *sid;
} WebIndependentLinkStruct;

typedef struct _web_independent_link_node *WebIndependentLinkPtr;

WebIndependentLinkPtr
new_web_independent_link(void);

void
delete_web_independent_link(WebIndependentLinkPtr ol);

void
LOGR_set_link(WebIndependentLinkPtr ol,TypePage tps, void *nodeptrs, 
	      TypePage tpt, void *nodeptrt);

void
LOGR_set_link_from_name(WebIndependentLinkPtr ol, char *urls, char *urlt,
			WebStatPtr wsf,GraphFrame *gf);

char *
LOGR_get_link_string_id(WebIndependentLinkPtr ol);

TypePage
LOGR_get_link_type_source_page(WebIndependentLinkPtr ol);

TypePage
LOGR_get_link_type_target_page(WebIndependentLinkPtr ol);

void *
LOGR_get_link_source_page(WebIndependentLinkPtr ol);

void *
LOGR_get_link_target_page(WebIndependentLinkPtr ol);

void
LOGR_set_link_naccesses(WebIndependentLinkPtr ol,long num);

void
LOGR_inc_link_naccesses(WebIndependentLinkPtr ol);

long
LOGR_get_link_naccesses(WebIndependentLinkPtr ol);

const char *
LOGR_get_link_source_url(WebIndependentLinkPtr ol);

const char *
LOGR_get_link_target_url(WebIndependentLinkPtr ol);

const char *
LOGR_get_link_source_title(WebIndependentLinkPtr ol);

const char *
LOGR_get_link_target_title(WebIndependentLinkPtr ol);

const char *
LOGR_get_link_source_mime(WebIndependentLinkPtr ol);

const char *
LOGR_get_link_target_mime(WebIndependentLinkPtr ol);

int
LOGR_get_link_source_size(WebIndependentLinkPtr ol);

int
LOGR_get_link_target_size(WebIndependentLinkPtr ol);

int
LOGR_get_link_source_http_code(WebIndependentLinkPtr ol);

int
LOGR_get_link_target_http_code(WebIndependentLinkPtr ol);

int
LOGR_get_link_source_naccesses(WebIndependentLinkPtr ol);

int
LOGR_get_link_target_naccesses(WebIndependentLinkPtr ol);

int
LOGR_get_link_source_num(WebIndependentLinkPtr ol);

int
LOGR_get_link_target_num(WebIndependentLinkPtr ol);

const char *
LOGR_get_local_node_url(TypePage tp, void *nodeptr);

const char *
LOGR_get_local_node_title(TypePage tp, void *nodeptr);

const char *
LOGR_get_local_node_mime(TypePage tp, void *nodeptr);

int 
LOGR_get_local_node_size(TypePage tp, void *nodeptr);

int 
LOGR_get_local_node_naccesses(TypePage tp, void *nodeptr);

extern char *
LOGR_gen_link_id(TypePage tps, void *nodeptrs, 
		 TypePage tpt, void *nodeptrt);

int
LOGR_is_independent_link(WebIndependentLinkPtr ol,char *urls,char *urlt);

extern char *
LOGR_gen_string_id(char *urls, char *urlt);

extern void *
LOGR_find_info_gen_page(char *url,TypePage *tp,WebStatPtr wsf,GraphFrame *gf);

int
LOGR_is_access_il_lower(WebIndependentLinkPtr u, WebIndependentLinkPtr v);

int
LOGR_is_access_il_bigger(WebIndependentLinkPtr u,WebIndependentLinkPtr v);


#endif

